32 | Getting Started with TypeScript
In this episode, James and Amy discuss everything you need to know to get up and running with TypeScript: what is TypeScript, why use TypeScript, the basic types, and how and where to go to get started.
In this episode, James and Amy discuss everything you need to know to get up and running with TypeScript: what is TypeScript, why use TypeScript, the basic types, and how and where to go to get started.
Sponsors
Vercel
Vercel combines the best developer experience with an obsessive focus on end-user performance. Their platform enables frontend teams to do their best work. It is the best place to deploy any frontend app. Start by deploying with zero configuration to their global edge network. Scale dynamically to millions of pages without breaking a sweat.
For more information, visit Vercel.com
ZEAL is hiring!
ZEAL is a computer software agency that delivers “the world’s most zealous” and custom solutions. The company plans and develops web and mobile applications that consistently help clients draw in customers, foster engagement, scale technologies, and ensure delivery.
ZEAL believes that a business is “only as strong as” its team and cares about culture, values, a transparent process, leveling up, giving back, and providing excellent equipment. The company has staffers distributed throughout the United States, and as it continues to grow, ZEAL looks for collaborative, object-oriented, and organized individuals to apply for open roles.
For more information visit softwareresidency.com/careers
DatoCMS
DatoCMS is a complete and performant headless CMS built to offer the best developer experience and user-friendliness in the market. It features a rich, CDN-powered GraphQL API (with real-time updates!), a super-flexible way to handle dynamic layouts and structured content, and best-in-class image/video support, with progressive/LQIP image loading out-of-the-box."
For more information, visit datocms.com
Show Notes
- 0:00 Introduction
- 3:27 What is TypeScript?
- 8:08 Sponsor - ZEAL
- 9:40 TypeScript and Bugs
- 17:08 Sponsor - Vercel
- 18:15 Typescript within VS Code
- 19:49 How to Get Started?
- Linter
- Number Blocks on Netflix
- 23:03 Different Types
- String
- Number
- Boolean
- Enums enum roles {
Admin = "ADMIN",
User = "USER",
Member = "MEMBER",
}
// or
enum roles {
Admin = 1,
User = 2,
Member = 3
} - Tuples
let x: [string, number];
x = ["hello", 10]; // OK
x = [10, "hello"]; // Error - Any
- 28:45 Taking it to the Next Level: Types vs. Interfaces
- Types type person = {
firstName: 'Amy',
lastName: 'Dutton'
} - Interfaces
interface person {
firstName: 'Amy';
lastName: 'Dutton';
}
- Types type person = {
- 30:38 Sponsor: DatoCMS
- 31:32 Resources to get Started Learning TypeScript
- 33:13 Grab Bag Questions
- 33:24 Types vs Interfaces
- 33:36 When is it appropriate to use TypeScript?
- 36:21 When is it a good idea to migrate a React project to TypeScript?
- 38:22 Which would you recommend? Going deeper on TypeScript or going deeper in React?
- 40:40 TypeScript vs JS Docs
- 42:32 Picks and Plugs
- 42:44 James's Pick - AirPods Pro
- 43:58 James's Plug - Code Connector Group in Slack
- 44:29 James's Plug - Virtual Coffee in Slack
- 44:50 Amy's Pick - Pock App
- 45:39 Amy's Plug - Advent of JavaScript and Advent of CSS